package com.hzhanghuan.floatmenu.app;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.hzhanghuan.floatmenu.FloatMenuButton;

/**
 * Created by Administrator on 2016/7/5.
 */
public class FloatMenuActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_float_menu);
        FloatMenuButton menuButton = (FloatMenuButton) findViewById(R.id.float_menu);
        FloatingActionButton actionButton1 = new FloatingActionButton(this);
        FloatingActionButton actionButton2 = new FloatingActionButton(this);
        FloatingActionButton actionButton3 = new FloatingActionButton(this);
        actionButton1.setImageResource(R.drawable.ic_add_alert_white_18dp);
        actionButton2.setImageResource(R.drawable.ic_message_white_18dp);
        actionButton3.setImageResource(R.drawable.ic_history_white_18dp);
        actionButton1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(), "1", Toast.LENGTH_SHORT).show();
            }
        });
        actionButton2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(), "2", Toast.LENGTH_SHORT).show();
            }
        });
        actionButton3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(), "3", Toast.LENGTH_SHORT).show();
            }
        });
        menuButton.setMenuItemView(actionButton1, actionButton2, actionButton3);
        menuButton.setMenuIcon(R.drawable.ic_menu_white_18dp);
        menuButton.setMenuColorRes(R.color.colorPrimary);
        menuButton.setMenuRipperColor(Color.RED);
        menuButton.setSpaceSize(5);

    }
}
